 var id = getvl("id");
 $(function(){
 	   if(id!=null){
 	   	  huoqu();
 	   }else{
 	   	//alert("登录异常...");
 	   }
 });
 
 
 
 function  huoqu(){
 		$("#xiangqin").html("");       
		 $("#jieshaos").html("");
		$.ajax({
             url:urlcore + "/api/wantBuy/selectOne?id="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					       var da=data.data;
					var lunbo='	<div id="slideBox" class="slideBox">'+
'		<div class="bd">'+
'			<ul>';
                   var headImg=da.goodsUrl;
                   var goodsimg="";
					   if(da.status==1){  //求购成功
		goodsimg+='<DIV style="position:absolute; top:0, left:0; width:400; height:300; z-index:0">'+
			'<img onerror="errorImg(this)" src="'+da.coverUrl+'" />'+
		   '</DIV><div> </div>'+
		   '<DIV style="position:absolute; top:20; left:190; width:200; height:100; text-align:center; z-index:2">'+
			'<IMG id=logo src="../images/qiugouchenggong.png" >'+
		'</DIV><br>';
			    }else{
			 goodsimg+='<div><img src="'+da.coverUrl+'" style="width: 100%;"></div><div> </div></br>';
			    }
					  lunbo+='<li><a><img src="'+da.coverUrl+'"></a></li>';
					if(headImg != null && headImg != '') {
						var imgarr1 = headImg.split("***");
            $.each(imgarr1, function(y,n) {
         goodsimg+='<div><img style="width: 100%;" onerror="errorImg(this)" src="'+n+'"></div><div> </div>';
            	lunbo+='<li>'+
             '	<a href="#"><img onerror="errorImg(this)" src="'+n+'" /></a>'+
'				</li>';
            });
           }
lunbo+='</ul>'+
'		</div>'+
'		<div class="hd">'+
'			<ul></ul>'+
'		</div>'+
'	</div>';
                 $("#goodsimg").append(goodsimg);
                    	$("#lunbo").append(lunbo);
					          $(function(){
					          		TouchSlide({ 
		slideCell:"#slideBox",
		titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
		mainCell:".bd ul", 
		effect:"leftLoop", 
		autoPage:true,//自动分页
		autoPlay:true //自动播放
	});
					          });
					          
					          var xiangqin='	<ul>'+
'		<li>'+
'			<span>发布商圈</span>';
   
    	  if(da.tradeAreaName!=null){
           if(da.tradeAreaName.length>16){
           	  xiangqin+='<em>'+da.tradeAreaName.substr(0 , 16)+"..."+'</em>';
          	
          }	else{
          	  xiangqin+='<em>'+da.tradeAreaName+'</em>';
          }
          }else{
          xiangqin+='<em></em>';
          }
    

xiangqin+='		</li>'+
'		<li>'+
'			<span>商品分类</span>'+
'			<em>'+da.wantBuyTypeName+'</em>'+
'		</li>'+
'	</ul>'+
'	<ul>'+
'		<li>'+
'			<span>联系人</span>';
    if(da.contactName!=null && da.contactName!=""){
    	xiangqin+='			<em>'+da.contactName+'</em>';
    }else{
    	xiangqin+='			<em>未填写</em>';
    }

xiangqin+='		</li>'+
'		<li>'+
'			<span>联系电话</span>'+
'			<em>'+da.phone+'</em>'+
'		</li>'+
'		<li>'+
'			<span>备用电话</span>';
if(da.qq==null)
xiangqin+='			<em>未填写</em>';
else
xiangqin+='			<em>'+da.qq+'</em>';

xiangqin+='		</li>'+
'		<li>'+
'			<span>需要数量</span>'+
'			<em>'+da.goodsNum+'件</em>'+
'		</li>'+
'		<li>'+
'			<span>需要地址</span>'+
'			<em>'+da.address+'件</em>'+
'		</li>'+
'	</ul>'+
'	<ul>'+
'		<li>'+
'			<span>商品颜色</span>';

           	  if(da.colourName!=null){
           if(da.colourName.length>16){
           	  xiangqin+='<em>'+da.colourName.substr(0 , 18)+"..."+'</em>';
          	
          }	else{
          	  xiangqin+='<em>'+da.colourName+'</em>';
          }
          }else{
          xiangqin+='<em></em>';
          }

  xiangqin+='		</li>'+
'		<li>'+
'			<span>商品尺码</span>';

  	  if(da.sizeName!=null){
           if(da.sizeName.length>16){
           	  xiangqin+='<em>'+da.sizeName.substr(0 , 18)+"..."+'</em>';
          	
          }	else{
          	  xiangqin+='<em>'+da.sizeName+'</em>';
          }
          }else{
          xiangqin+='<em></em>';
          }

 xiangqin+='		</li>'+
'	</ul>';
	        			$("#xiangqin").append(xiangqin);       
					      $("#jieshaos").html(da.goodsDescribe);
				} 
			},
			error: function() {
				alert("error");
			}
		});

 }
 

 function  chenggong(str){
   if(uuuuid!=""){
   	$.ajax({
             url:urlcore + "/api/wantBuy/selectSuccess2?id="+id+"&userid="+uuuuid+"&status="+str,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
			window.location.href = document.referrer;
				}else{
					alert(data.msg);
				}
				
			},
			error: function() {
				alert("error");
			}
		});
   }else{
   	alert("请检查是否登录");
   }
		
 }
 